package com.youhome.common.enums;

/**
 * Created by chen365 on 2019/02/28.
 * 角色枚举
 */
public enum RoleEnum {

    COMPANY(1, "COMPANY", "公司管理员"),
    COUNSELOR(2, "COUNSELOR", "顾问"),
    CLIENT(3, "CLIENT", "客户");

    private Integer key;
    private String role;
    private String description;

    RoleEnum(Integer key, String role, String description) {
        this.key = key;
        this.role = role;
        this.description = description;
    }

    //根据key获取枚举
    public static RoleEnum getEnumByKey(Integer key) {
        if (null == key) {
            return null;
        }
        for (RoleEnum temp : RoleEnum.values()) {
            if (temp.getKey().equals(key)) {
                return temp;
            }
        }
        return null;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
